
    use: 'ie.ondevice.objectkit.utility.compiler.AnnotationParser';

    ClassFile.implement
    (
        {
            /**
             * @private
             * @type {Array}
             */
            annotations: null
            
            /**
             * @private
             * @type {Array}
             */
        ,   dependencies: null  
          
            /**
             * The relative path to the this class file.
             * @type {String}
             */
        ,   path: null
        
            /**
             * The contained classes canonical name, that is, its namespace
             * and local name combined.
             * @type {String}
             */
        ,   canonicalName: null
        
            /**
             * The contained classes local name, that is, its name without
             * any namespace prefix.
             * @type {String}
             */
        ,   localName: null
        
            /**
             * The namespace in which this class resides, as determined by
             * its position in the file system
             * @type {String}
             */
        ,   namespace: null
        
            /**
             * The class files text contents, assumed to be JavaScript
             * source code.
             * @type {String}
             */
        ,   sourceCode: null
        
            /**
             * Get all the annotations declared in the class file. The returned
             * object is a map, with each member an array representing the
             * occurances of an annotation of a particular type.
             * 
             * @example
             *     <code>
             *         <pre>
             *             var annotations= classFile.getAnnotations();
             *             for (var annotationType in annotations)
             *             {
             *                 var occurances= annotations[annotationType];
             *             }
             *             
             *             var useAnntations= annotations['use'];
             *         </pre>
             *     </code>
             * @return {Object}
             */
        ,   getAnnotations: function () 
            {
                if (!this.annotations) 
                {
                    this.annotations= new AnnotationParser().parseAnnotations(this);
                }
                
                return this.annotations;
            }
            
            /**
             * Get annotations declared in this class file by their name.
             * 
             * @param {String} name    The annotation name
             * @return {Array.<Annotation>}    A collection of annotations
             * @throws {ReferenceError} If no annotations are declared
             */
        ,   getDeclaredAnnotations: function(name) 
            {
                var annotations= this.getAnnotations();
                if (name in annotations)
                    return annotations[name];
                    
                throw new ReferenceError("Undeclared annotation: " + name);
            }
            
            /**
             * Get a list of the classes that this class depends on. If no
             * dependencies are inferred, an empty array is returned.
             * 
             * @return {Array.<String>}    A list of class names
             */
        ,   getDependencies: function () 
            {
                if (this.dependencies)
                    return this.dependencies;
                
                var dependencies= []
                ,   annotations= this.getAnnotations()
                ,   annotation
                ,   annotations
                    
                if ('use' in annotations) 
                {
                    annotations= annotations['use'];
                    for (var i= 0, n= annotations.length; i<n; i++) 
                    {
                        annotation= annotations[i];
                        dependencies.push(annotation.value)    
                    }
                }

                return this.dependencies= dependencies;
            }
            
            /**
             * Get the file size.
             * @return {Number}
             */
        ,   getFileSize: function () 
            {
                return this.sourceCode.length;
            }
            
            /**
             * @return {String}
             * @override
             */
        ,   toString: function () 
            {
                return this.path;//this.canonicalName; // + ' - ' + this.path;
            }
        }
    );
    
    /**
     * A value object representing a class file.
     * 
     * @param {String} canonicalName
     * @param {String} path
     * @param {String} sourceCode
     * @constructor
     */
    function ClassFile (canonicalName, path, sourceCode) 
    {
        var namespace= canonicalName.split('.');
        this.canonicalName= canonicalName;
        this.localName= namespace.pop();
        this.namespace= namespace.join('.');
        this.path= path;
        this.sourceCode= sourceCode;
    };
